/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2013
 */

package com.bbs.bean;

import javacommon.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "bbs_block")
public class BbsBlock extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//alias
	public static final String TABLE_ALIAS = "BbsBlock";
	public static final String ALIAS_BLOCK_ID = "版块id";
	public static final String ALIAS_BLOCK_NAME = "版块名称";
	public static final String ALIAS_BLOCK_TITLE_NUM = "版块主题数";
	public static final String ALIAS_BLOCK_REPLY_NUM = "版块回复数";
	public static final String ALIAS_BLOCK_CREATETIME = "创建时间";
	public static final String ALIAS_BLOCK_LAST_TITLE_TIME = "最后发表的主题的时间";
	public static final String ALIAS_BLOCK_LAST_TITLE_USERID = "最后发表的用户id";
	public static final String ALIAS_BLOCK_LAST_TITLE = "最后发表的主题";
	public static final String ALIAS_BLOCK_LAST_TITLE_USERNAME = "最后发表的用户名字";
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * 版块id       db_column: block_id 
     */ 	
	
	private java.lang.Integer blockId;
    /**
     * 版块名称       db_column: block_name 
     */ 	
	@Length(max=100)
	private java.lang.String blockName;
    /**
     * 版块主题数       db_column: block_title_num 
     */ 	
	
	private java.lang.Integer blockTitleNum;
    /**
     * 版块回复数       db_column: block_reply_num 
     */ 	
	
	private java.lang.Integer blockReplyNum;
    /**
     * 创建时间       db_column: block_createtime 
     */ 	
	@Length(max=20)
	private java.lang.String blockCreatetime;
    /**
     * 最后发表的主题的时间       db_column: block_last_title_time 
     */ 	
	@Length(max=20)
	private java.lang.String blockLastTitleTime;
    /**
     * 最后发表的用户id       db_column: block_last_title_userid 
     */ 	
	
	private java.lang.Integer blockLastTitleUserid;
    /**
     * 最后发表的主题       db_column: block_last_title 
     */ 	
	@Length(max=100)
	private java.lang.String blockLastTitle;
    /**
     * 最后发表的用户名字       db_column: block_last_title_username 
     */ 	
	@Length(max=50)
	private java.lang.String blockLastTitleUsername;
	//columns END


	public BbsBlock(){
	}

	public BbsBlock(
		java.lang.Integer blockId
	){
		this.blockId = blockId;
	}

	

	public void setBlockId(java.lang.Integer value) {
		this.blockId = value;
	}
	
	@Id @GeneratedValue(generator="custom-id")
	@GenericGenerator(name="custom-id", strategy = "increment")
	@Column(name = "block_id", unique = true, nullable = false, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getBlockId() {
		return this.blockId;
	}
	
	@Column(name = "block_name", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getBlockName() {
		return this.blockName;
	}
	
	public void setBlockName(java.lang.String value) {
		this.blockName = value;
	}
	
	@Column(name = "block_title_num", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getBlockTitleNum() {
		return this.blockTitleNum;
	}
	
	public void setBlockTitleNum(java.lang.Integer value) {
		this.blockTitleNum = value;
	}
	
	@Column(name = "block_reply_num", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getBlockReplyNum() {
		return this.blockReplyNum;
	}
	
	public void setBlockReplyNum(java.lang.Integer value) {
		this.blockReplyNum = value;
	}
	
	@Column(name = "block_createtime", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public java.lang.String getBlockCreatetime() {
		return this.blockCreatetime;
	}
	
	public void setBlockCreatetime(java.lang.String value) {
		this.blockCreatetime = value;
	}
	
	@Column(name = "block_last_title_time", unique = false, nullable = true, insertable = true, updatable = true, length = 20)
	public java.lang.String getBlockLastTitleTime() {
		return this.blockLastTitleTime;
	}
	
	public void setBlockLastTitleTime(java.lang.String value) {
		this.blockLastTitleTime = value;
	}
	
	@Column(name = "block_last_title_userid", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Integer getBlockLastTitleUserid() {
		return this.blockLastTitleUserid;
	}
	
	public void setBlockLastTitleUserid(java.lang.Integer value) {
		this.blockLastTitleUserid = value;
	}
	
	@Column(name = "block_last_title", unique = false, nullable = true, insertable = true, updatable = true, length = 100)
	public java.lang.String getBlockLastTitle() {
		return this.blockLastTitle;
	}
	
	public void setBlockLastTitle(java.lang.String value) {
		this.blockLastTitle = value;
	}
	
	@Column(name = "block_last_title_username", unique = false, nullable = true, insertable = true, updatable = true, length = 50)
	public java.lang.String getBlockLastTitleUsername() {
		return this.blockLastTitleUsername;
	}
	
	public void setBlockLastTitleUsername(java.lang.String value) {
		this.blockLastTitleUsername = value;
	}
	

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("BlockId",getBlockId())
			.append("BlockName",getBlockName())
			.append("BlockTitleNum",getBlockTitleNum())
			.append("BlockReplyNum",getBlockReplyNum())
			.append("BlockCreatetime",getBlockCreatetime())
			.append("BlockLastTitleTime",getBlockLastTitleTime())
			.append("BlockLastTitleUserid",getBlockLastTitleUserid())
			.append("BlockLastTitle",getBlockLastTitle())
			.append("BlockLastTitleUsername",getBlockLastTitleUsername())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getBlockId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof BbsBlock == false) return false;
		if(this == obj) return true;
		BbsBlock other = (BbsBlock)obj;
		return new EqualsBuilder()
			.append(getBlockId(),other.getBlockId())
			.isEquals();
	}
}

